import 'dart:async';

import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:sgy_flutter/ble/ble_manager.dart';
import 'package:sgy_flutter/ble/mixins/mixin_manager.dart';
import 'package:sgy_flutter/model/device_model.dart';

mixin BatteryService on MixinBleManager {

  static const serviceGuid = ("0000180f-0000-1000-8000-00805f9b34fb");
  static const guidCharacteristicWrite = ("00002a19-0000-1000-8000-00805f9b34fb");

  Rxn<num> rssi = Rxn();

  @override
  FutureOr onDeviceInstallServices(DeviceModel? model, List<BluetoothService> services) {
    for (final service in services){
      if (service.serviceUuid.str128.toLowerCase() == serviceGuid){
        for (final characteristic in service.characteristics) {
          final characteristicGuid = characteristic.uuid.str128.toLowerCase();
        }
      }
    }
    return super.onDeviceInstallServices(model, services);
  }
}

mixin BatteryService1 on MixinBleManager{

  static const serviceGuid = ("0000180f-0000-1000-8000-00805f9b34fb");
  static const guidCharacteristicWrite = ("00002a19-0000-1000-8000-00805f9b34fb");

  Rxn<num> rssi = Rxn();

  @override
  FutureOr onDeviceInstallServices(DeviceModel? model, List<BluetoothService> services) {
    // TODO: implement onDeviceInstallServices
    return super.onDeviceInstallServices(model, services);
  }
}

